import { _decorator, Component, Node, Label, v3 } from 'cc'
const { ccclass, property } = _decorator

@ccclass('Test')
export class Test extends Component {
  curPos = v3()

  start() {
    console.log(777777)

    console.log(this)
    console.log(this.node)
    console.log(this.node.position)
    console.log(this.node.angle) // 2d旋转
    console.log(this.node.rotation) // 3d旋转
    console.log(this.node.scale)

    // const labelComp = this.node.getComponent(Label)
    // console.log(labelComp.string)

    // labelComp.string = 'Hello World'
  }

  // deltaTime =  1 / 电脑帧数
  update(deltaTime: number) {
    // 修改位置
    // const p = this.node.position
    // p.x += 1
    // this.node.position = p
    // 修改位置优化
    this.node.getPosition(this.curPos)
    this.curPos.x += 100 * deltaTime
    this.node.setPosition(this.curPos)
  }
}
